/**
 *
 * @param url
 * @param args
 * @param beforeSendCall
 * @param successCall
 */
function sendPostJsonRequest(url, args, beforeSendCall,successCall){

    $.ajax({
        url       : url,
        type      : 'POST',
        dataType  : 'json',
        async     : true,
        timeout   : 6000,
        data      : args,

        beforeSend:function () {
            if(beforeSendCall){beforeSendCall();}
        }

    })
        .done(function (resultData) {
            if(successCall){successCall(resultData)}
        })
        .fail(function (jqXHR, textStatus) {
            switch (textStatus){
                case "timeout":
                    ajaxErrorTrans("Y1001","响应超时","服务器端响应请求超时");
                    break;
                case "error":
                    $.each(jqXHR.statusCode(),function (propertyKey,propertyValue) {
                        if(propertyKey == 'status'){
                            if(propertyValue.startsWith('4')) {
                                if(propertyValue == '404'){
                                    ajaxErrorTrans("Y2101","请求地址无效","请求服务地址不存在");
                                }else {
                                    ajaxErrorTrans("Y2102","请求错误","请求信息有误");
                                }

                            }else if (propertyValue.startsWith('5') || propertyValue.startsWith('6')){
                                ajaxErrorTrans("Y2201","服务器异常","服务器内部异常");
                            }

                        }
                    });
                    break;
                case "notmodified":
                    ajaxErrorTrans("Y3101","确认缓存","请使用带版本号的请求方式");
                    break;
                case "parsererror":
                    ajaxErrorTrans("Y3101","dataType","ajax解析返回数据类型失败");
                    break;
                default:
                    ajaxErrorTrans("Y9999","未知错误","未知错误");
                    break;
            }

        })


       


}

